package com.fzl.spring_chatroom.common.config;

import com.fzl.spring_chatroom.controller.TestWebSockedController;
import com.fzl.spring_chatroom.controller.WebSocketController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;

@Configuration
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {

//    @Autowired
//    private TestWebSockedController testWebSockedController;

    @Autowired
    private WebSocketController webSocketController;

    @Override
    public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
        //注册路径
        //registry.addHandler(testWebSockedController,"/test");
        registry.addHandler(webSocketController,"/webmessage");
    }
}
